<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <script src="./promise2.js"></script>
    </head>
    <body>
        <script>
            console.dir(Promise);
            const p1 = new Mypromise((resolve, reject) => {
                setTimeout(() => {
                    resolve('111');
                }, 1000);
            });

            const p2 = p1.then((res) => {
                console.log(res);
                return '222';
            });
            // p2.then((res) => {
            //     console.log(res);
            // });
            // let p3 = Mypromise.resolve('222');
            // let p4 = Mypromise.resolve('333');
            // let p5 = Mypromise.all([p1, p3, p4]);
            // console.log(p5.then((res) => console.log(res)));

            // let p6 = Mypromise.race([p1, p3, p4]);
            // p6.then((res) => {
            //     console.log(res);
            // });

            let p3 = Mypromise.resolve('111');
            console.log(p3);
            let p5 = Mypromise.all([p1, p3]);
            console.log(p5.then((res) => console.log(res)));
        </script>
    </body>
</html>
